package pers.fulsun.es.test._02_index;

import java.io.IOException;
import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest;
import org.elasticsearch.action.support.master.AcknowledgedResponse;
import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.client.RestHighLevelClient;
import pers.fulsun.es.test._01_ESClient;

public class _03_ESTest_Index_Delete {
  private static RestHighLevelClient client = _01_ESClient.getClient();

  public static void main(String[] args) throws IOException {
    // 删除索引 - 请求对象
    DeleteIndexRequest request = new DeleteIndexRequest("user");
    // 发送请求，获取响应
    AcknowledgedResponse response = client.indices().delete(request, RequestOptions.DEFAULT);
    // 响应状态
    System.out.println(response.isAcknowledged());
    // 关闭客户端连接
    client.close();
  }
}
